package org.ezplatform.office.meeting.notice.dao;

import java.util.List;

import org.ezplatform.core.dao.jpa.JpaBaseDao;
import org.ezplatform.office.meeting.notice.entity.NoticeTurnover;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface NoticeTurnoverDao extends JpaBaseDao<NoticeTurnover, String> {

	@Modifying
    @Query(value = "delete from NoticeTurnover n where n.applyRecordId in (?1)")
    void deleteByApplyrecordId(String... id);
	
	@Query(value = "from NoticeTurnover n where n.applyRecordId=?1 and n.turnoverUserId=?2 and n.corpId=?3")
	NoticeTurnover findByApplyrecordId(String applyRecordId, String turnoverUserId, String corpId);
	
	@Query(value = "from NoticeTurnover n where n.applyRecordId=?1 and n.receiveUserId=?2 and n.corpId=?3")
	List<NoticeTurnover> findNoticeTurnoverList(String applyRecordId, String receiveUserId, String corpId);
	
	@Modifying
    @Query(value = "delete from NoticeTurnover n where n.applyRecordId =?1 and n.corpId=?2")
    void deleteNoticeTurnover(String applyrecordId, String corpId);
}
